package br.com.uniti.academico.persistence.manager.professor.impl;

import br.com.uniti.academico.persistence.entity.Professor;
import br.com.uniti.academico.persistence.manager.professor.ProfessorManager;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class ProfessorManagerImpl implements ProfessorManager {
    @PersistenceContext
    EntityManager entityManager;

    @Override
    public Professor salvar(Professor professor) {
        if (professor.getNome() == null){
            throw new IllegalArgumentException("O nome do professor não pode ser nulo.");
        }
        entityManager.persist(professor);
        return professor;
    }
    
}
